<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="keywords" content=""/>
    <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
    <meta name="keyWords" contect=""><!--关键词搜索-->
    <meta http-equiv="windows-Target" contect="_top">
    <title>合作伙伴登录</title>
    <link href="/statics/front/css/partner-login-main.css" rel="stylesheet">
    <link href="/statics/front/css/common.css" rel="stylesheet">
</head>
<body>
<div class="modal fade modal_bg" data-backdrop="static" id="loginModal"><!--防止用户点击空白处关闭--> </div>
<div class="login_content">
    <img src="/statics/front/images/partner/bg0.jpg">
    <div class="login_main">
        <img class="bg_opacity" src="/statics/front/images/partner/bg_opacity.png">
        <div class="login_inputbox">
            <form method="post" id="loginForm">
                <div class="login_tittle">账号登录</div>
                <div class="input_wrap">
                    <img src="/statics/front/images/partner/admin.png">
                    <input type="text" name="username">
                </div>

                <div class="input_wrap">
                    <img src="/statics/front/images/partner/keys.png">
                    <input type="password" name="password">
                </div>
                <button type="submit" name="dosubmit" class="login_btn width-full btn js-submit">登录</button>
                <div class="login_register">
                    <a href="<?php echo url('user/getpassword');?>"><div class="forget_password">忘记密码</div></a>
                </div>
            </form>
        </div>
    </div>
</div>
<script src="/statics/front/js/lib/jquery/1.9.1/jquery.js"></script>
<script src="/statics/front/js/plugins/validate/1.11.1/jquery.validate.js"></script>
<script src="/statics/front/js/plugins/jquery.popupBox.js"></script>

<script>
    $(function () {
        <?php if($_GET['loginbox'] == 'show'):?>
        $('#loginModal').modal('show');
        <?php endif;?>
        /*标签页切换*/
        $(".js-tabs").on("click", "li", function () {
            var _self = $(this),
                _index = _self.index();
            _self.find("span").addClass("current").end().siblings().find("span").removeClass("current");
            $(".tabs-con").find(".tab-content").eq(_index).show().siblings().hide();
        });

        /*FAQ*/
        $('.js-faq').on('click', 'li > strong', function () {
            $(this).toggleClass("curs").find(".fa").toggleClass("fa-minus").end().siblings("p").stop().toggle("slideDown");
        });

        /*登录表单验证*/
        $("#loginForm").validate({
            errorElement: 'p',
            submitHandler: function (form) {
                form.submit();
            },
            errorPlacement: function (error, element) {
                element.after(error);
            },
            rules: {
                username: {
                    required: true,
                    email: true
                },
                password: {
                    required: true,
                    rangelength: Array(6, 20)
                }
            },
            messages: {
                username: {
                    required: "<?php echo L('input_email_addres');?>",
                    email: "<?php echo L('_EMAIL_FORMAT_ERROR_');?>"
                },
                password: {
                    required: "<?php echo L('input_login_passwd');?>",
                    rangelength: "<?php echo L('_THE_PASSWORD_SHOULD_BE_BETWEEN_6_20_');?>"
                }
            }
        });

        /*登录表单验证*/
        $("#loginForm_2").validate({
            errorElement: 'p',
            submitHandler: function (form) {
                form.submit();
            },
            errorPlacement: function (error, element) {
                element.after(error);
            },
            rules: {
                username: {
                    required: true,
                    email: true
                },
                password: {
                    required: true,
                    rangelength: Array(6, 20)
                }
            },
            messages: {
                username: {
                    required: "<?php echo L('input_email_addres');?>",
                    email: "<?php echo L('_EMAIL_FORMAT_ERROR_');?>"
                },
                password: {
                    required: "<?php echo L('input_login_passwd');?>",
                    rangelength: "<?php echo L('_THE_PASSWORD_SHOULD_BE_BETWEEN_6_20_');?>"
                }
            }
        });
        /*feedback表单验证*/
        $("#partnerFeedbackForm").validate({
            errorElement: 'p',
            submitHandler: function (form) {
                submitpartnerFeedbackForm();
            },
            errorPlacement: function (error, element) {
                element.after(error);
            },
            rules: {
                email: {
                    required: true,
                    email: true
                }
            },
            messages: {
                email: {
                    required: "<?php echo L('input_email_addres');?>",
                    email: "<?php echo L('_EMAIL_FORMAT_ERROR_');?>"
                }
            }
        });

        //partner submit
        function submitpartnerFeedbackForm() {
            var $partnerFeedbackForm = $('#partnerFeedbackForm');
            $.ajax({
                type: 'POST',
                url: "/groupBuying/formpost",
                data: {
                    'type': 'partner',
                    'name': $('input[name="name"]', $partnerFeedbackForm).val(),
                    'email': $('input[name="email"]', $partnerFeedbackForm).val(),
                    'phone': $('input[name="phone"]', $partnerFeedbackForm).val(),
                    'company_name': $('input[name="company_name"]', $partnerFeedbackForm).val(),
                    'business_website': $('input[name="business_website"]', $partnerFeedbackForm).val(),
                    'company_employees': $('input[name="company_employees"]', $partnerFeedbackForm).val(),
                    'country': $('input[name="country"]', $partnerFeedbackForm).val(),
                    'annual_revenue': $('input[name="annual_revenue"]', $partnerFeedbackForm).val(),
                    'business_introduce': $('textarea[name="business_introduce"]', $partnerFeedbackForm).val(),
                    'work_plan': $('textarea[name="work_plan"]', $partnerFeedbackForm).val()
                },
                cache: false,
                success: function (res) {
                    if (res == 1) {
                        var _tips = "<?php echo L('msg_submit_is_successful')?>";
                        $("#partnerFeedbackForm")[0].reset();
                    } else {
                        _tips = "<?php echo L('msg_submit_is_failure')?>";
                    }
                    $("p.tips")[0] && $("p.tips").remove();
                    $("#partnerFeedbackForm").find('.js-submit').parent().append("<p class='align-center tips'>" + _tips + "</p>");
                },
                error: function () {
                    var _tips = "<?php echo L('msg_submit_is_failure')?>";
                    $("p.tips")[0] && $("p.tips").remove();
                    $("#partnerFeedbackForm").find('.js-submit').parent().append("<p class='align-center tips'>" + _tips + "</p>");
                }
            });
        }
    });
</script>
</body>
</html>